#define _CRT_SECURE_NO_WARNINGS 1

#include<string>
#include<iostream>
using namespace std;
//
//int main()
//{
//	for (unsigned char ch = 0; ch < 128; ++ch)
//	{
//		cout << ch << " ";
//	}
//	string s("star plantinum the world.cpp.cccc.eeee.hhh");
//	//rfind
//	//find
//	cout << endl;
//	
//	size_t pos = s.rfind('.');
//	if (pos != string::npos)
//	{
//		string suff = s.substr(pos,s.size()-pos);
//
//		
//		cout << suff << endl;
//	}
//	
//	
//}





namespace bit
{
	class string
	{
		/*string()
			:_str(new char[1])
			, _size(0)
			, _capacity(0)
		{
			_str[0] = '\0';
		}*/


		//string(const char* str = "\0")
		string(const char* str = "")
		{
			_size = strlen(str);
			_capacity = _size;
			_str = new char[_capacity + 1];

			strcpy(_str, str);
		}

		~string()
		{
			delete[] _str;
			_str = nullptr;
			_size = _capacity = 0;
		}

		const char* c_str() const
		{
			return _str;
		}

	private:
		char* _str;
		size_t _size;
		size_t _capacity;
	};

	void test_string1()
	{
		std::string s1("star plantinum");
		std::string s2;

		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;
	}

}

using namespace bit;

int main()
{
	test_string1();
	std::string strText = "How are you?";

	std::string strSeparator = " ";

	std::string strResult;

	int size_pos = 0;

	int size_prev_pos = 0;

	while ((size_pos = strText.find_first_of(strSeparator, size_pos)) != std::string::npos)

	{

		strResult = strText.substr(size_prev_pos, size_pos - size_prev_pos);

		cout << strResult << " ";

		size_prev_pos = ++size_pos;

	}

	if (size_prev_pos != strText.size())

	{

		strResult = strText.substr(size_prev_pos, size_pos - size_prev_pos);

		cout << strResult << " ";

	}

	cout << endl;

	return 0;
}


